<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style>
        html,
        body {
            width: 100%;
            min-height: 100%;
            background: #f7f7f7;
            line-height: 1;
        }
        /*列表样式*/

        .list_box {
            background-color: #f7f7f7;
            padding: 0.45rem 0;
            line-height: 1.5;
        }

        .list_box .list_all_info_box {
            padding: 0 0.95rem;
            padding-bottom: 0.95rem;
            background-color: #fff;
        }

        .list_box .list_all_info_box .user_info_box {
            display: flex;
            align-items: center;
            padding: 0.95rem 0;
        }

        .list_box .list_all_info_box .user_info_box .user_img {
            width: 2.45rem;
            margin-right: 0.95rem;
        }

        .list_box .list_all_info_box .user_info_box .name_time_box .user_name {
            font-size: 0.8rem;
            font-weight: 600;
            color: #333;
        }

        .list_box .list_all_info_box .user_info_box .name_time_box .time {
            font-size: 0.6rem;
            color: #999;
        }

        .list_box .list_all_info_box .txt_box {
            font-size: 0.8rem;
            color: #333;
            text-align: justify;
        }

        .list_box .list_all_info_box .a_box div {
            display: flex;
            align-items: center;
            margin: 0.95rem 0;
            padding: 0.45rem;
            background-color: #f7f7f7;
            margin-bottom: 0;
        }

        .list_box .list_all_info_box .a_box div .a_img {
            width: 2.45rem;
            margin: 0;
            margin-right: 0.45rem;
        }

        .list_box .list_all_info_box .a_box div .a_title {
            font-size: 0.7rem;
            color: #333;
        }
        /*分享 评论 赞*/

        .three_modular_box {
            background-color: #fff;
        }

        .three_title_box {
            padding: 0 0.75rem;
        }

        .three_title_box div {
            font-size: 0.7rem;
            color: #999;
            position: relative;
            float: left;
            padding: 0.75rem 0;
        }

        .three_title_box div:last-child {
            float: right;
        }

        .three_title_box div.active {
            color: #333;
            font-weight: 600;
        }

        .three_title_box div::after {
            content: "";
            height: 1px;
            width: 0;
            background-color: #ff0036;
            position: absolute;
            bottom: 0.2rem;
            left: 50%;
            transform: translateX(-50%);
            transition: 0.4s;
        }

        .three_title_box div.active::after {
            width: 1.5rem;
        }

        .three_title_box .comment_box {
            /*flex: 1;*/
            margin-left: 1.25rem;
        }
        /*分享列表样式*/

        .share_list_box,
        .fabulous_list_box {
            margin-bottom: 2.8rem;
        }

        .share_list_box li,
        .fabulous_list_box li {
            display: flex;
            align-items: center;
            padding: 0.5rem 0.75rem;
            position: relative;
        }

        .share_list_box li::after,
        .fabulous_list_box li::after {
            content: "";
            height: 1px;
            width: calc(100% - 0.75rem);
            background-color: #edeae8;
            position: absolute;
            bottom: 0rem;
            right: 0;
        }

        .share_list_box li img,
        .fabulous_list_box li img {
            width: 1.5rem;
            margin-right: 0.75rem;
        }

        .share_list_box li span,
        .fabulous_list_box li span {
            font-size: 0.8rem;
            color: #333;
        }
        /*评论列表*/

        .comment_list_box {
            margin-bottom: 2.8rem;
        }

        .comment_list_box li {
            padding: 1rem 0.75rem;
            position: relative;
        }

        .comment_list_box li::after {
            content: "";
            height: 1px;
            width: calc(100% - 0.75rem);
            background-color: #edeae8;
            position: absolute;
            bottom: 0;
            right: 0;
        }

        .comment_list_box li .friend_info_box {
            display: flex;
            align-items: center;
        }

        .comment_list_box li .friend_img {
            width: 1.95rem;
            height: 1.95rem;
        }

        .comment_list_box li .dz_img {
            width: 0.75rem;
        }

        .comment_list_box li .name_time_box {
            flex: 1;
            margin-left: 0.75rem;
            line-height: 1.5;
        }

        .comment_list_box li .name_time_box .friend_name {
            font-size: 0.7rem;
            color: #333;
        }

        .comment_list_box li .name_time_box .time {
            font-size: 0.6rem;
            color: #999;
        }

        .comment_list_box li .friend_txt {
            text-align: justify;
            line-height: 1.5;
            padding: 0.75rem 0;
        }

        .comment_list_box li .more_box {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .comment_list_box li .more_box img {
            width: 0.75rem;
        }

        .comment_list_box li .more_box .more_left {
            font-size: 0.6rem;
            color: #247ed7;
        }

        .comment_list_box li .more_box .more_left .icon {
            font-size: 0.6rem;
        }
        /*底部固定按钮*/

        .three_btn_box {
            position: fixed;
            display: flex;
            width: 100vw;
            justify-content: space-around;
            padding: 0.6rem 0 0.6rem 0;
            bottom: 0;
            background-color: #fff;
        }

        .three_btn_box .btn {
            display: flex;
            align-items: center;
        }

        .three_btn_box .btn img {
            width: 0.8rem;
            margin-right: 0.3rem;
        }

        .three_btn_box .btn span {
            font-size: 0.7rem;
            color: #999;
        }

        .input_box {
            /*background: red;*/
            background-color: #fff;
            position: fixed;
            bottom: 0;
            width: 100vw;
            height: 2.25rem;
            display: none;
        }

        .input_box textarea {
            padding: 0.5rem;
            min-height: 2.25rem;
            line-height: 1.5;
            width: 85%;
            float: left;
        }

        .input_box .finish_btn {
            width: 15%;
            float: left;
            line-height: 2.25rem;
            min-height: 2.25rem;
        }
    </style>
</head>

<body>
    <div class="app" v-cloak>
        <div class="friend_list">

            <ul class="all_list_box">

                <li class="list_box">
                    <div class="list_all_info_box">

                        <div class="user_info_box">
                            <!-- 判断用户头像 -->
                            <!-- <img v-if="dynamic_info.head_img!=''" :src="dynamic_info.head_img" alt="" class="user_img">
                            <img v-else src="../../image/four/test.jpg" alt="" class="user_img"> -->
                            <div class="user_img" :style="'background:url('+dynamic_info.head_img+') center/cover no-repeat;width:2.45rem;height:2.45rem;'"></div>

                            <div class="name_time_box">
                                <div class="user_name">{{dynamic_info.username}}</div>
                                <div class="time">{{dynamic_info.addtime}}</div>
                            </div>
                        </div>


                        <div v-if="dynamic_info.content!=''" class="txt_box">{{dynamic_info.content}}</div>


                        <!-- 判断详情的类型 -->
                        <!-- 图文分享  带字 -->
                        <ul v-if="dynamic_info.type==1 && dynamic_info.content!='' && dynamic_info.pic!=''" class="aui-list aui-media-list" style="background-image: none;padding-top: 0.95rem;">
                            <li class="aui-list-item" style="background-image: none;padding-left: 0;">
                                <div class="aui-list-item-inner" style="padding: 0;">
                                    <div class="aui-row aui-row-padded">
                                        <div v-for="(img_src,index) in dynamic_info.pic" class="aui-col-xs-4">
                                            <!-- <img src="../../image/four/test.jpg"> -->
                                            <div class="img" :style="'background:url('+img_src+') center/cover no-repeat;'" @click='look_img(index+1)'></div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>

                        <!-- 图文分享  不带字 -->
                        <ul v-else-if="dynamic_info.type==1 && dynamic_info.content=='' && dynamic_info.pic==''" class="aui-list aui-media-list" style="background-image: none;">
                            <li class="aui-list-item" style="background-image: none;padding-left: 0;">
                                <div class="aui-list-item-inner" style="padding: 0;">
                                    <div class="aui-row aui-row-padded">
                                        <div v-for="(img_src,index) in dynamic_info.pic" class="aui-col-xs-4">
                                            <!-- <img src="../../image/four/test.jpg"> -->
                                            <div class="img" :style="'background:url('+img_src+') center/cover no-repeat;'" @click='look_img(index+1)'></div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>

                        <!-- 商品分享  带文本 -->
                        <div class="a_box" v-else-if="dynamic_info.type==2 && dynamic_info.content!='' && dynamic_info.logo_pic!=''" @click="openShopDetail('',dynamic_info.goods_id,dynamic_info.user_id)">
                            <div>
                                <!-- <img v-if="dynamic_info.logo_pic!=''" :src="dynamic_info.logo_pic" alt="" class="a_img"> -->
                                <!-- <img v-else src="../../image/four/test.jpg" alt="" class="a_img"> -->

                                <div class="a_img" v-if="dynamic_info.logo_pic!=''" :style="'background:url('+dynamic_info.logo_pic+') center/cover no-repeat;height:2.45rem;'"></div>
                                <div class="a_img" v-else style="background:url(../../image/four/test.jpg) center/cover no-repeat;height:2.45rem;"></div>

                                <span class="a_title">{{dynamic_info.goods_name}}-{{dynamic_info.goods_title}}</span>
                            </div>
                        </div>
                        <!-- 商品分享  不带文本 -->
                        <div class="a_box" v-else-if="dynamic_info.type==2 && dynamic_info.content=='' && dynamic_info.logo_pic!=''" @click="openShopDetail('',dynamic_info.goods_id,dynamic_info.user_id)">
                            <div style="margin-top:0;">
                                <!-- <img v-if="dynamic_info.logo_pic!=''" :src="dynamic_info.logo_pic" alt="" class="a_img"> -->
                                <!-- <img v-else src="../../image/four/test.jpg" alt="" class="a_img"> -->

                                <div class="a_img" v-if="dynamic_info.logo_pic!=''" :style="'background:url('+dynamic_info.logo_pic+') center/cover no-repeat;height:2.45rem;'"></div>
                                <div class="a_img" v-else style="background:url(../../image/four/test.jpg) center/cover no-repeat;height:2.45rem;"></div>

                                <span class="a_title">{{dynamic_info.goods_name}}-{{dynamic_info.goods_title}}</span>
                            </div>
                        </div>


                        <!-- 转发图文 带文本 -->
                        <ul v-if="dynamic_info.type==3 && dynamic_info.forward.forward_type==1 && dynamic_info.content!=''" class="aui-list aui-media-list" style="background-image: none;padding-top: 0.95rem;">
                            <li class="aui-list-item" style="background-image: none;padding-left: 0;">
                                <div class="aui-list-item-inner" style="padding: 0;">
                                    <div class="aui-row aui-row-padded">
                                        <div v-for="(img_src,index) in dynamic_info.forward.forward_pic" class="aui-col-xs-4">
                                            <div class="img" :style="'background:url('+img_src+') center/cover no-repeat;'" @click='look_img(index+1)'></div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        <!-- 转发图文 不带文本 -->
                        <ul v-else-if="dynamic_info.type==3 && dynamic_info.forward.forward_type==1 && dynamic_info.content==''" class="aui-list aui-media-list" style="background-image: none;">
                            <li class="aui-list-item" style="background-image: none;padding-left: 0;">
                                <div class="aui-list-item-inner" style="padding: 0;">
                                    <div class="aui-row aui-row-padded">
                                        <div v-for="(img_src,index) in dynamic_info.forward.forward_pic" class="aui-col-xs-4">
                                            <!-- <img src="../../image/four/test.jpg"> -->
                                            <div class="img" :style="'background:url('+img_src+') center/cover no-repeat;'" @click='look_img(index+1)'></div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>

                        <!-- 转发商品  带文本 -->
                        <div class="a_box" v-if="dynamic_info.type==3 && dynamic_info.forward.forward_type==2 && dynamic_info.content!=''" @click="openShopDetail('',dynamic_info.forward.forward_goods_id,dynamic_info.user_id)">
                            <div>
                                <!-- <img v-if="dynamic_info.forward.forward_logo_pic!=''" :src="dynamic_info.forward.forward_logo_pic" alt="" class="a_img"> -->
                                <!-- <img v-else src="../../image/four/test.jpg" alt="" class="a_img"> -->

                                <div class="a_img" v-if="dynamic_info.forward.forward_logo_pic!=''" :style="'background:url('+dynamic_info.forward.forward_logo_pic+') center/cover no-repeat;height:2.45rem;'"></div>
                                <div class="a_img" v-else style="background:url(../../image/four/test.jpg) center/cover no-repeat;height:2.45rem;"></div>

                                <span class="a_title">{{dynamic_info.forward.forward_goods_name}}-{{dynamic_info.forward.forward_goods_title}}</span>
                            </div>
                        </div>
                        <!-- 转发商品  不带文本 -->
                        <div class="a_box" v-else-if="dynamic_info.type==3 && dynamic_info.forward.forward_type==2 && dynamic_info.content==''"  @click="openShopDetail('',dynamic_info.forward.forward_goods_id,dynamic_info.user_id)">
                            <div style="margin-top:0;">
                                <!-- <img v-if="dynamic_info.forward.forward_logo_pic!=''" :src="dynamic_info.forward.forward_logo_pic" alt="" class="a_img"> -->
                                <!-- <img v-else src="../../image/four/test.jpg" alt="" class="a_img"> -->

                                <div class="a_img" v-if="dynamic_info.forward.forward_logo_pic!=''" :style="'background:url('+dynamic_info.forward.forward_logo_pic+') center/cover no-repeat;height:2.45rem;'"></div>
                                <div class="a_img" v-else style="background:url(../../image/four/test.jpg) center/cover no-repeat;height:2.45rem;"></div>
                                <span class="a_title">{{dynamic_info.forward.forward_goods_name}}-{{dynamic_info.forward.forward_goods_title}}</span>
                            </div>
                        </div>

                    </div>
                </li>

                <div class="three_modular_box">
                    <div class="three_title_box clearfix aui-border-b">
                        <!-- <div v-if="forward_num!=0" class="share_box active">分享 {{forward_num}}</div>
                        <div v-else class="share_box active">分享</div> -->

                        <div v-if="item_num!=0" class="comment_box" style="margin-left:0;">评论 {{item_num}}</div>
                        <div v-else class="comment_box" style="margin-left:0;">评论</div>

                        <div v-if="likecount!=0" class="fabulous_box">赞 {{likecount}}</div>
                        <div v-else class="fabulous_box">赞</div>
                    </div>

                    <!-- 分享的列表框 -->
                    <!-- <ul class="share_list_box">
                        <li v-for="zf_friend in zf_list">

                            转发好友的头像判断
                            <img v-if="zf_friend.head_img" :src="zf_friend.head_img" alt="">
                            <img v-else src="../../image/four/test.jpg" alt="">

                            转发好友的名字判断
                            <span v-if="zf_friend.username!=''">{{zf_friend.username}}</span>
                            <span v-else>该好友暂无昵称</span>
                        </li>
                    </ul> -->



                    <!-- 评论列表框 -->
                    <ul class="comment_list_box" style="display:none;">
                        <li v-for="(pl_friend,index) in pl_list">
                            <div class="friend_info_box">
                                <!-- 头像判断 -->
                                <!-- <img v-if="pl_friend.head_img" :src="pl_friend.head_img" alt="" class="friend_img">
                                <img v-else src="../../image/four/test.jpg" alt="" class="friend_img"> -->

                                <div class="friend_img" :style="'background:url('+pl_friend.head_img+') center/cover no-repeat;width:1.95rem; height:1.95rem;'"></div>

                                <div class="name_time_box">
                                    <!-- 名字判断 -->
                                    <div v-if="pl_friend.username" class="friend_name">{{pl_friend.username}}</div>
                                    <div v-else class="friend_name">该用户还未填写昵称</div>
                                    <!-- 时间判断 -->
                                    <div v-if="pl_friend.addtime" class="time">{{pl_friend.addtime}}</div>
                                    <div v-else class="time"></div>
                                </div>
                                <img v-if="pl_friend.is_like==0" src="../../image/four/dz_off.png" alt="" class="dz_img" @click="dz_pl(pl_friend.dynamic_item_id,index)">
                                <img v-else src="../../image/four/dz_on.png" alt="" class="dz_img" @click="dz_pl(pl_friend.dynamic_item_id,index)">
                            </div>

                            <!-- 评论内容判断 -->
                            <div v-if="pl_friend.content" class="friend_txt">{{pl_friend.content}}</div>
                            <div v-else class="friend_txt"></div>

                            <div class="more_box">
                                <!-- 判断是否有更多评论 -->
                                <div v-if="pl_friend.item_num!=0" class="more_left" @click="open_new_win('one','更多回复','回复详情','',pl_friend.dynamic_item_id)">共{{pl_friend.item_num}}条评论<i class="aui-iconfont aui-icon-right icon"></i></div>
                                <div v-else class="more_left"></div>
                                <img src="../../image/four/pl_off.png" alt="" @click="up_keyboard('回复评论',pl_friend.dynamic_item_id)">
                            </div>
                        </li>
                    </ul>





                    <!-- 赞的列表框 -->
                    <ul class="fabulous_list_box" style="display:none;">
                        <li v-for="dz_friend in dz_list">

                            <!-- 点赞好友的头像判断 -->
                            <img v-if="dz_friend.head_img" :src="dz_friend.head_img" alt="">
                            <img v-else src="../../image/four/test.jpg" alt="">

                            <!-- 点赞好友的名字判断 -->
                            <span v-if="dz_friend.username!=''">{{dz_friend.username}}</span>
                            <span v-else>该好友暂无昵称</span>
                        </li>
                    </ul>
                </div>
            </ul>

        </div>


        <!-- 底部固定按钮 -->
        <div class="three_btn_box">
            <!-- <div class="btn" onclick="up_keyboard('转发')">
                <img src="../../image/four/fx_off.png" alt="">
                <span>分享</span>
            </div> -->
            <div class="btn" onclick="up_keyboard('评论')">
                <img src="../../image/four/pl_off.png" alt="">
                <span>评论</span>
            </div>

            <div class="btn" @click="to_dz()">
                <img v-if="is_like==1" src="../../image/four/dz_on.png" alt="">
                <img v-else src="../../image/four/dz_off.png" alt="">
                <span>赞</span>
            </div>
        </div>


        <div class="input_box clearfix">
            <textarea name="name" cols="80" class="text_input" placeholder="请输入您想表达的话"></textarea>
            <div class="finish_btn">完成</div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript">
    apiready = function() {



        // 实例化vue 数据渲染
        var dynamic_detail = new Vue({
            el: '.app',
            data: {
                dynamic_info: {},
                zf_list: [],
                pl_list: [],
                dz_list: [],
                is_item: 0,
                is_like: 0,
                is_forward: 0,
                likecount: 0,
                dz_click: 1,
                item_num: 0,
                forward_num: 0,
                page:1,
                img_arr:[]
            },

            mounted: function() {
                var $_this = this;


                $_this.get_datas();
                $_this.dz_list_function();
                $_this.pl_list_function();
                $_this.zf_list_function();
                // $_this.scroll_load();

            },

            methods: {
                // 查看图片
                look_img:function(img_index){
                  var $_this = this;
                  api.openWin({
                      name: 'look_img_win',
                      url: 'four_headers/look_img_header.html',
                      pageParam: {
                          imgs_arr:$_this.img_arr,
                          img_index:img_index
                      }
                  });

                },
                get_datas:function(){
                  var $_this = this;
                  //请求动态详情的数据接口
                  api.ajax({
                      url: window.Url.Community_dynamicDetails,
                      method: 'post',
                      data: {
                          values: {
                              token: $api.getStorage('token'),
                              dynamic_id: api.pageParam.dynamic_id
                          }
                      }
                  }, function(ret, err) {
                      if (ret) {
                          console.log('获取到的动态详情信息---'+ JSON.stringify( ret ) );
                          if (ret.re == 1) {
                              if (ret.data.list) {
                                  $_this.dynamic_info = ret.data.list;
                                  // console.log('获取到的动态详情信息---' + JSON.stringify($_this.dynamic_info));
                                  $_this.is_like = ret.data.list.is_like;
                                  $_this.likecount = ret.data.list.likecount;
                                  $_this.item_num = ret.data.list.item_num;
                                  $_this.forward_num = ret.data.list.forward_num;

                                  if(ret.data.list.pic.length<=0){
                                    $_this.img_arr = ret.data.list.forward.forward_pic;
                                  }else{
                                    $_this.img_arr = ret.data.list.pic;
                                  }


                                  $_this.$nextTick(function() {
                                      $('.img').height($('.img').width())
                                  })
                              }
                          }

                      } else {
                          alert(JSON.stringify(err));
                      }
                  });
                },
                to_dz: function() {
                    var $_this = this;
                    if ($_this.is_like == 0) {
                        $_this.dz_click = 1;
                    } else {
                        $_this.dz_click = 2;
                    }
                    api.ajax({
                        url: window.Url.Community_addLike,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('user_data').token,
                                dynamic_id: api.pageParam.dynamic_id,
                                like_type: $_this.dz_click,
                                type: 1
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            // alert( JSON.stringify( ret ) );
                            if (ret.re == 1) {
                                api.execScript({
                                    name: 'four_five_header',
                                    frameName: 'friend_person_list',
                                    script: 'window.location.reload();'
                                });

                                api.execScript({
                                    name: 'four_frame/four_index.html',
                                    frameName: 'friend_list',
                                    script: 'window.location.reload();'
                                });

                                api.toast({
                                    msg: ret.info
                                });

                                if (ret.info == "点赞成功") {
                                    $_this.is_like = 1;
                                    $_this.likecount = parseInt($_this.likecount) + 1;
                                    $_this.dz_list_function();
                                } else {
                                    $_this.is_like = 0;
                                    $_this.likecount = parseInt($_this.likecount) - 1;
                                    $_this.dz_list = [];
                                    $_this.dz_list_function();
                                }
                            }
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });

                },
                // 点赞列表获取接口
                dz_list_function: function() {
                    var $_this = this;
                    // 请求点赞列表接口
                    api.ajax({
                        url: window.Url.Community_likeList,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('token'),
                                dynamic_id: api.pageParam.dynamic_id,
                                page: $_this.page
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            if (ret.re == 1) {
                                if (ret.data.list) {
                                    $_this.dz_list = ret.data.list;
                                    // console.log('获取到的动态点赞列表---' + JSON.stringify($_this.dz_list));
                                }
                            }
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                },

                // 评论列表获取接口
                pl_list_function: function() {
                    var $_this = this;
                    // 请求评论列表接口
                    api.ajax({
                        url: window.Url.Community_replyList,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('token'),
                                dynamic_id: api.pageParam.dynamic_id,
                                page: $_this.page
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            if (ret.re == 1) {
                                if (ret.data.list) {
                                    $_this.pl_list = ret.data.list;
                                    // console.log('获取到的动态评论列表---' + JSON.stringify($_this.pl_list));
                                }
                            }
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                },

                // 获取转发列表接口
                zf_list_function: function() {
                    var $_this = this;
                    // 请求转发列表接口
                    api.ajax({
                        url: window.Url.Community_forwardList,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('token'),
                                dynamic_id: api.pageParam.dynamic_id,
                                page: $_this.page
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            if (ret.re == 1) {
                                if (ret.data.list) {
                                    $_this.zf_list = ret.data.list;
                                    // console.log('获取到的动态转发列表---' + JSON.stringify($_this.zf_list));
                                }
                            }
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                },
                // 给好友的评论点赞
                dz_pl:function(hf_pl_id,index){
                  var pl_like_type = 1;

                  var $_this = this;

                  if($_this.pl_list[index].is_like==1){
                    pl_like_type = 2;
                  }else{
                    pl_like_type = 1;
                  }
                  // alert(index+" "+hf_pl_id+" "+$_this.pl_list[index].is_like)
                  api.ajax({
                      url: window.Url.Community_addLike,
                      method: 'post',
                      data: {
                          values: {
                            token: $api.getStorage('user_data').token,
                            dynamic_id: api.pageParam.dynamic_id,
                            dynamic_item_id:hf_pl_id,
                            like_type: pl_like_type,
                            type: 2
                          }
                      }
                  },function(ret, err){
                      if (ret) {

                          if(ret.re==1){
                            $_this.pl_list_function();
                          }

                          api.toast({
                              msg: ret.info,
                              duration: 2000,
                              location: 'bottom'
                          });



                      } else {
                          alert( JSON.stringify( err ) );
                      }
                  });

                },

                // 打开商品详情页
                openShopDetail:function(name,targetId,userId){
                  api.openWin({
                      name: 'commodity',
                      url: '../one_frame/commodity.html',
                      pageParam: {
                          name: name,
                          id: targetId,
                          userId:userId
                      }
                  });
                },

                scroll_load:function(){
                  var $_this = this;
                  var scroll = new auiScroll({
                        listen: true, //是否监听滚动高度，开启后将实时返回滚动高度
                        distance: 40 //判断到达底部的距离，isToBottom为true
                    }, function(ret) {
                        if (ret.isToBottom) {
                            $_this.page++
                            // 点赞
                            api.ajax({
                                url: window.Url.Community_likeList,
                                method: 'post',
                                data: {
                                    values: {
                                        token: $api.getStorage('token'),
                                        dynamic_id: api.pageParam.dynamic_id,
                                        page: $_this.page
                                    }
                                }
                            }, function(ret, err) {
                                if (ret) {
                                    if (ret.re == 1) {
                                        if (ret.data.list) {
                                            $_this.dz_list =   $_this.dz_lis.concat(ret.data.list);
                                        }
                                    }
                                } else {
                                    alert(JSON.stringify(err));
                                }
                            });

                            // 评论
                            api.ajax({
                                url: window.Url.Community_replyList,
                                method: 'post',
                                data: {
                                    values: {
                                        token: $api.getStorage('token'),
                                        dynamic_id: api.pageParam.dynamic_id,
                                        page: $_this.page
                                    }
                                }
                            }, function(ret, err) {
                                if (ret) {
                                    if (ret.re == 1) {
                                        if (ret.data.list) {
                                            $_this.pl_list = $_this.pl_list.concat(ret.data.list);
                                            // console.log('获取到的动态评论列表---' + JSON.stringify($_this.pl_list));
                                        }
                                    }
                                } else {
                                    alert(JSON.stringify(err));
                                }
                            });

                            // 转发
                            api.ajax({
                                url: window.Url.Community_forwardList,
                                method: 'post',
                                data: {
                                    values: {
                                        token: $api.getStorage('token'),
                                        dynamic_id: api.pageParam.dynamic_id,
                                        page: $_this.page
                                    }
                                }
                            }, function(ret, err) {
                                if (ret) {
                                    if (ret.re == 1) {
                                        if (ret.data.list) {
                                            $_this.zf_list = $_this.zf_list.concat(ret.data.list);
                                            // console.log('获取到的动态转发列表---' + JSON.stringify($_this.zf_list));
                                        }
                                    }
                                } else {
                                    alert(JSON.stringify(err));
                                }
                            });

                        }

                    });
                }

            }
        })

    };


    // 打开新的窗口
    function open_new_win(index, title, type,right_txt,hf_pl_id) {
        api.openWin({
            name: 'four_' + index + '_header' + index,
            url: 'four_headers/four_' + index + '_header.html',
            pageParam: {
                title: title,
                type: type,
                hf_pl_id:hf_pl_id
            }
        });

    }


    // 分享 评论 赞 点击切换底部事件
    $('body').on('click', '.three_title_box div', function() {
        var btn_index = $(this).index();
        $('.three_modular_box > ul').eq(btn_index).show().siblings('ul').hide()
        $(this).addClass('active').siblings().removeClass('active');
    })



    // 弹出键盘
    function up_keyboard(type,hf_pl_id) {
        $('.input_box').show();
        // $('.input_box .text_input').blur();
        // 使用模块弹出键盘
        var softInput = api.require('softInputMgr');
        softInput.toggleKeyboard();
        // 将相应的输入框获取焦点
        $('.input_box .text_input').focus();
        $('.finish_btn').unbind();
        if (type == "转发") {
            $('.finish_btn').click(function() {
                if ($('.text_input').val() == "") {
                    api.toast({
                        msg: '请填写转发内容',
                        duration: 2000,
                        location: 'bottom'
                    });

                } else {
                    down_keyboard();
                    // 请求转发接口
                    api.ajax({
                        url: window.Url.Community_forwardingDynamic,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('user_data').token,
                                dynamic_id: api.pageParam.dynamic_id,
                                content: "" + $('.text_input').val()
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            api.toast({
                                msg: ret.info,
                                duration: 2000,
                                location: 'bottom'
                            });
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                }
            })
        } else if (type == "评论") {
            $('.finish_btn').click(function() {
                if ($('.text_input').val() == "") {
                    api.toast({
                        msg: '请填写评论内容',
                        duration: 2000,
                        location: 'bottom'
                    });

                } else {
                    down_keyboard();
                    // 请求转发接口
                    api.ajax({
                        url: window.Url.Community_replyDynamic,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('user_data').token,
                                dynamic_id: api.pageParam.dynamic_id,
                                content: "" + $('.text_input').val(),
                                type: 1
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            api.toast({
                                msg: ret.info,
                                duration: 2000,
                                location: 'bottom'
                            });
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                }
            })
        } else if (type == "回复评论") {

            $('.finish_btn').click(function() {
                if ($('.text_input').val() == "") {
                    api.toast({
                        msg: '请填写评论内容',
                        duration: 2000,
                        location: 'bottom'
                    });

                } else {
                    down_keyboard();
                    // 请求转发接口
                    api.ajax({
                        url: window.Url.Community_replyDynamic,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('user_data').token,
                                content: "" + $('.text_input').val(),
                                dynamic_item_id:hf_pl_id,
                                type: 2
                            }
                        }
                    }, function(ret, err) {
                        if (ret) {
                            api.toast({
                                msg: ret.info,
                                duration: 2000,
                                location: 'bottom'
                            });
                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                }
            })
        }
    }


    function down_keyboard() {
        $('.input_box .text_input').blur();
        $('.input_box').hide();
    }
</script>

</html>
